#pragma once
#include "../Ode.h"

namespace Skill
{
	namespace Ode
	{
		ref class DVector3;
		namespace Geometries
		{			
			public ref class DVertexBuffer sealed: DIUnmanagedPointer
			{
				INTERNAL_CLASS_DECLARATION(DVertexBuffer,dReal);
			private:			
				int sizeInByte;
				int vertexCount;
			public:
				UNMANAGEDPOINTER_DECLARATION();

				///<summary>
				/// Helper class to handle unmanaged vertexbuffer
				///</summary>						
				///<param name = "vertexCount">  Number of vertices</param>
				DVertexBuffer(int vertexCount)
				{				
					this->vertexCount = vertexCount;
					sizeInByte = vertexCount * 12;
					_This = new dReal[vertexCount * 3]();
				}
				void SetData(array<float>^ data,int startIndex,int lenght);
				void SetData(array<float>^ data);

				void SetVertex(int vertexIndex,dReal x,dReal y,dReal z);
				void SetVertex(int vertexIndex,DVector3^ vertex);

				void SetHeightAt(int vertexIndex , dReal height);
				dReal GetHeightAt(int vertexIndex);

				DVector3^ GetReferenceVertex(int vertexIndex);

				VALUE_PROP_DECLARATION_GET(int,SizeInByte);
				VALUE_PROP_DECLARATION_GET(int,VertexCount);			
				VALUE_PROP_DECLARATION_GET(int,VertexStride);
			};


			
		}
	}
}